<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Paperclip::Storage::Filesystem</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Paperclip::Storage::Filesystem</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/paperclip/lib/paperclip/storage_rb.html">
                vendor/plugins/paperclip/lib/paperclip/storage.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
The default place to store attachments is in the filesystem. Files on the
local filesystem can be very easily served by Apache without requiring a
hit to your app. They also can be processed more easily after they&#8216;ve
been saved, as they&#8216;re just normal files. There is one <a
href="Filesystem.html">Filesystem</a>-specific option for
has_attached_file.
</p>
<ul>
<li><tt>path</tt>: The location of the repository of attachments on disk. This
can (and, in almost all cases, should) be coordinated with the value of the
<tt>url</tt> option to allow files to be saved into a place where Apache
can serve them without hitting your app. Defaults to
&quot;:rails_root/public/:attachment/:id/:style/:basename.:extension&quot;
By default this places the files in the app&#8216;s public directory which
can be served directly. If you are using capistrano for deployment, a good
idea would be to make a symlink to the capistrano-created system directory
from inside your app&#8216;s public directory. See
Paperclip::Attachment#interpolate for more information on variable
interpolaton.

<pre>
  :path =&gt; &quot;/var/app/attachments/:class/:id/:style/:basename.:extension&quot;
</pre>
</li>
</ul>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000090">exists?</a>&nbsp;&nbsp;
      <a href="#M000089">extended</a>&nbsp;&nbsp;
      <a href="#M000091">to_file</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000089" class="method-detail">
        <a name="M000089"></a>

        <div class="method-heading">
          <a href="#M000089" class="method-signature">
          <span class="method-name">extended</span><span class="method-args">(base)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000089-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/paperclip/lib/paperclip/storage.rb, line 20</span>
20:       <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extended</span> <span class="ruby-identifier">base</span>
21:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000090" class="method-detail">
        <a name="M000090"></a>

        <div class="method-heading">
          <a href="#M000090" class="method-signature">
          <span class="method-name">exists?</span><span class="method-args">(style_name = default_style)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000090-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/paperclip/lib/paperclip/storage.rb, line 23</span>
23:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">style_name</span> = <span class="ruby-identifier">default_style</span>)
24:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">original_filename</span>
25:           <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>(<span class="ruby-identifier">style_name</span>))
26:         <span class="ruby-keyword kw">else</span>
27:           <span class="ruby-keyword kw">false</span>
28:         <span class="ruby-keyword kw">end</span>
29:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000091" class="method-detail">
        <a name="M000091"></a>

        <div class="method-heading">
          <a href="#M000091" class="method-signature">
          <span class="method-name">to_file</span><span class="method-args">(style_name = default_style)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns representation of the data of the file assigned to the given style,
in the format most representative of the current storage.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000091-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/paperclip/lib/paperclip/storage.rb, line 33</span>
33:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_file</span> <span class="ruby-identifier">style_name</span> = <span class="ruby-identifier">default_style</span>
34:         <span class="ruby-ivar">@queued_for_write</span>[<span class="ruby-identifier">style_name</span>] <span class="ruby-operator">||</span> (<span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>(<span class="ruby-identifier">style_name</span>), <span class="ruby-value str">'rb'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">style_name</span>))
35:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>